package com.cms.action;

import java.util.ArrayList;
import java.util.List;

import com.action.DefaultAction;
import com.cms.manager.LanguageManager;
import com.cms.model.Language;

public class LanguageAction extends DefaultAction {

	public String show()
	{
		if(msg.equals("update"))
		{
			language = service.getById(language.getId());
		}
		return SUCCESS;
	}
	
	public String save()
	{
		if(msg.equals("insert"))
		{
			if(service.insert(language))
			{
				msg="语言管理：添加语言成功！！";
			}
			else
			{
				msg="语言管理：对不起，添加语言可能存在问题，请稍候重试一下！！";
			}
		}
		else if(msg.equals("update"))
		{
			if(service.update(language))
			{
				msg="语言管理：更新语言成功！！";
			}
			else
			{
				msg="语言管理：对不起，更新语言可能存在问题，请稍候重试一下！！";
			}
		}
		else if(msg.equals("del"))
		{
			if(service.delete(language))
			{
				msg="语言管理：删除语言成功！！";
			}
			else
			{
				msg="语言管理：对不起，删除语言可能存在问题，请稍候重试一下！！";
			}
		}
		return SUCCESS;
	}
	
	public String list()
	{
		llist = service.getAll();
		return SUCCESS;
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = -9058217486871747390L;

	private LanguageManager service = LanguageManager.getInstance();
	private Language language = new Language();
	private List<Language> llist = new ArrayList<Language>();
	private String msg="";
	public Language getLanguage() {
		return language;
	}
	public void setLanguage(Language language) {
		this.language = language;
	}
	public List<Language> getLlist() {
		return llist;
	}
	public void setLlist(List<Language> llist) {
		this.llist = llist;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	
			
}
